package ma.ensao.evalmetrics.util.javaProjects;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class ComponentsCalc {
	File sourceFile;
	private int nbClasses=0;
	private int nbMethodes=0;
	private int nbAttributs=0;
	
	
	public ComponentsCalc(File file) throws FileNotFoundException, IOException{
		setSourceFile(file);
		JavaMethodsAttributes JM= new JavaMethodsAttributes(getSourceFile());
		JM.countMethods();
		JM.countAttributes();

		// Calcule MHF pour tout les classes
		
		nbClasses += JM.getNumberClasses();
		for (int i = 0; i < JM.getNumberClasses(); i++) {
				nbMethodes += JM.getNumberMethods()[i];
				nbAttributs += JM.getNumberAttributes()[i];
			
		}
		
		
	}
	public File getSourceFile() {
		return sourceFile;
	}
	public void setSourceFile(File sourceFile) {
		this.sourceFile = sourceFile;
	}
	public int getNbClasses() {
		return nbClasses;
	}
	public void setNbClasses(int nbClasses) {
		this.nbClasses = nbClasses;
	}
	public int getNbMethodes() {
		return nbMethodes;
	}
	public void setNbMethodes(int nbMethodes) {
		this.nbMethodes = nbMethodes;
	}
	public int getNbAttributs() {
		return nbAttributs;
	}
	public void setNbAttributs(int nbAttributs) {
		this.nbAttributs = nbAttributs;
	}
	
}
